package com.haojin.exer;

public class Account {

	public static void main(String[] args) {
		
	}
	
    private int id;//账户
    private double balance;//余额
    private double annualInterestRate;//年利率
    
    public Account(int id,double balance,double annualInterestRate){
    	this.id = id;
    	this.balance = balance;
    	this.annualInterestRate = annualInterestRate;
    }
    public double getBalance(){
    	return balance;
    }
    public double getAnnualInterestRate(){
    	return annualInterestRate;
    }
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public void setBalance(double balance) {
		this.balance = balance;
	}
	public void setAnnualInterestRate(double annualInterestRate) {
		this.annualInterestRate = annualInterestRate;
	}
    //取款方式withdraw中，需要判断用户余额能否满足提款数额要求，不能则给出提示
	public void withdraw(double amount){//取钱
		if(balance >= amount){
		  balance -= amount;
		  System.out.println("成功取出："+amount);
		}
		else{
             System.out.println("余额不足，取款失败");
		}
		
	}
	
	public void deposit(double amount){//存钱
		if(amount > 0){
			balance += amount;
			System.out.println("成功存入："+amount);
		}
	
	}
}


